//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
    public static void main(String[] args) {
        //1.BM28二叉树的最大深度(左右子树最大路径+1)
        public int maxDepth (TreeNode root) {
            return maxDepthChild(root);
        }
        private int maxDepthChild(TreeNode root) {
            if(root == null) {
                return 0;
            }
            //记录左子树的个数
            int leftTree = maxDepthChild(root.left);
            //记录右子树的个数
            int rightTree = maxDepthChild(root.right);
            //返回左子树与右子树中最大的路径再加1
            return Math.max(leftTree,rightTree) + 1;
        }
        //2.BM30二叉搜索树与双向链表(中序遍历)
        public TreeNode prve = null;
        public TreeNode head = null;
        public TreeNode Convert(TreeNode pRootOfTree) {
            if (pRootOfTree == null) {
                return null;
            }
            //二叉树中序遍历
            Convert(pRootOfTree.left);
            if (prve == null) {
                prve = pRootOfTree;
                head = pRootOfTree;
            } else {
                prve.right = pRootOfTree;
                pRootOfTree.left = prve;
                //更新prve节点
                prve = pRootOfTree;
            }
            Convert(pRootOfTree.right);
            return head;
        }
    }
}